package com.heima.leadnews.admin.controller.v1;


import com.heima.leadnews.admin.service.AdLoginService;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.login.dto.AdUserDto;
import com.heima.model.login.pojo.AdUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户登录功能
 */
@RestController
@RequestMapping("/login")
@Api("用户登录功能")
public class AdLoginController {

    @Autowired
    AdLoginService adLoginService;


    @ApiOperation("登录功能")
    @PostMapping("/in")
    public ResponseResult login(@RequestBody AdUserDto dto){
        return adLoginService.login(dto);
    }

    @ApiOperation("注册功能")
    @PostMapping("/register")
    public ResponseResult register(@RequestBody AdUser user){
        return adLoginService.register(user);
    }
}
